/*
 * 创建日期 2005-10-5
 *
 * 更改所生成文件模板为
 * 窗口 > 首选项 > Java > 代码生成 > 代码和注释
 */
package com.vanda.report.view;

import com.vanda.report.ExcelUtils;
import com.vanda.report.ReportException;
import com.vanda.report.ReportInnerData;
import com.vanda.report.element.Element;
/**
 * 将数据写入Cell开始标签 <br>
 * <p>
 * 
 * @author eagle <br>
 * @version Version 1.00 <br>
 */
public class CellsElement extends Element {
	/** 指定开始行数 */
	private int start_row ;
	/** 指定开始列数 */
	private String start_col ;
	
	public void validator() throws ReportException{
	}
	
	/**
	 * 标签执行方法，递归执行
	 * @param obj
	 */
	public void execute(Object obj) throws ReportException{
		ReportInnerData reportData = (ReportInnerData)obj;
		try{
			//reportData.setContextData(reportData);
			int startRow = 0;
			if(start_row <= 0){
				startRow = reportData.getCurrentRow();
			}else{
				startRow = start_row;
			}
			reportData.setFormatRowNum(0);
			
			reportData.setStart_col(ExcelUtils.getColIndex(start_col));
			reportData.setStart_row(startRow);
			
			//设置currentCol
			if(reportData.getStart_col() <= 0){
				reportData.setCurrentCol(0);
			}else{
				reportData.setCurrentCol(reportData.getStart_col() - 1);
			}

			super.execute(obj);

			reportData.setCurrentCol(0);

		}catch(ReportException e){
			throw e;
		}catch(Exception e){
			throw new ReportException(e);
		}

	}
	
	/**
	 * @return
	 */
	public int getStart_row() {
		return start_row;
	}

	/**
	 * @param i
	 */
	public void setStart_row(int i) {
		start_row = i;
	}

	/**
	 * @return
	 */
	public String getStart_col() {
		return start_col;
	}

	/**
	 * @param string
	 */
	public void setStart_col(String string) {
		start_col = string;
	}

}
